<?php
namespace backend\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use backend\models\User;
use yii\filters\VerbFilter;

/**
 * Site controller
 */
class UserController extends CommonController
{
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
        ];
    }

    /**
     * @inheritdoc
     */
    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
        ];
    }

    /**
     * 添加用户列表和用户搜索
     * @return Json
     */
    public function actionIndex()
    {
         $data['info']=User::UserList();
        return $this->render('list',$data);
    }

    /**
     * 用户信息读取
     * @return [type] [description]
     */
    public function actionUserInfo()
    {
        $id=intval($this->getParam('id','',"ID是必须存在的"));
        $info=User::findIdentity($id);
        if (!empty($info)) {
            return print_r($info->attributes);
        }else{
            $this->out(Self::EXP_EMPTY, Self::EXP_EMPTY_TXT,'','PAGE');
        }

    }
    /**
     * 用户信息修改
     * @return [type] [description]
     */
    public function actionUserEdit()
    {

    }
}
